package com.zhouyer.sqlSession;

import com.zhouyer.pojo.Configuration;
import com.zhouyer.pojo.MappedStatement;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

public interface Executor {
    /**
     * 查询记录
     *
     * @param configuration   配置（包括数据库配置和sql映射配置）
     * @param mappedStatement sql映射对象
     * @param params          查询参数
     * @param <E>
     * @return
     */
    <E> List<E> query(Configuration configuration, MappedStatement mappedStatement, Object... params) throws SQLException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException, IntrospectionException, InvocationTargetException, InstantiationException;

    /**
     * 更新记录
     *
     * @param configuration   配置（包括数据库配置和sql映射配置）
     * @param mappedStatement sql映射对象
     * @param params          更新的实体参数
     * @return
     */
    int update(Configuration configuration, MappedStatement mappedStatement, Object... params) throws SQLException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException;
}
